package com.icehelper.hades.base.util.id;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Leon Sun
 * @desc <br/>
 * @since 2022/7/1
 */
@Configuration
public class SnowFlakeConfig {

  @Value("${snow-flake.datacenter-id:1}")
  private long datacenterId;

  @Value("${snow-flake.worker-id:1}")
  private long workId;

  @Bean
  public SnowFlakeId snowFlake() {
    return new SnowFlakeId(workId, datacenterId);
  }

}
